package org.mathcloud.math.core.generic.operator.trigonometry;

import org.mathcloud.math.core.common.operator.trigonometry.Arcsech;
import org.mathcloud.math.core.common.quantity.RealNumber;
import org.mathcloud.math.core.generic.operator.GenericUnaryOperator;
import org.mathcloud.math.core.generic.quantity.GenericRealNumber;

public class GenericArcsech extends GenericUnaryOperator implements Arcsech
{
	public GenericArcsech()
	{
		super();
		signature.setMMLContentTag("arcsech");
	}

	@Override
	public void calculate()
	{
		Double d;
		if (operand.getSignature().isRealNumberSignature()) {
			d= ((RealNumber)operand).getValue();
			res = new GenericRealNumber(Math.log((1.0+Math.sqrt(1.0-d*d))/d));
		}
	}
}

